export default  function onClick(){
    ['mousedown', 'touchstart'].forEach( eventType => { 
        document.addEventListener(eventType, function(event) {
            const target=event.target as HTMLElement | null;;
            if(target?.tagName){
                const reportData={
                    type:'behavior',
                    subType: 'click',
                    target : target.tagName,
                    startTime: event.timeStamp,
                    innerHtml: target.innerHTML,
                    outerHtml: target.outerHTML,
                    with: target.offsetWidth,
                    height: target.offsetHeight,
                    eventType,
                    // path:event.path,
                    path: (event as unknown as { path: (HTMLElement | EventTarget)[] }).path?.map(el =>
                        (el as HTMLElement).outerHTML
                      ),
                }
                //TODO上报数据
            }
        })
})
}